import React from 'react';
import { Form } from '@ant-design/compatible';
import '@ant-design/compatible/assets/index.css';
import { SearchAndSelectC, FirstHeaderC, AdvancedSearch, DATA_ENTRY } from '../../../comps';
import config from '../../../comps/business/searchAndSelect/enum';
import { thresholdFreedmanDiaconis } from 'd3';
class SearchAndSelect extends React.Component {
  constructor(props) {
    super(props);

    this.state = {
      initialValue: undefined,
    };
    setTimeout(() => {
      this.setState({
        initialValue: '02',
      });
    }, 0);
  }
  onQuery = (query) => {
    // query[this.state.name]=this.state.code
    // delete query['productId,productName']
    console.log(query, 'query');
  };
  onClear = () => {};
  onChange = (name, code) => {
    this.setState({ name, code });
  };
  render() {
    return (
      <>
        <FirstHeaderC title='产品管理' />
        <SearchAndSelectC
          form={this.props.form}
          title='产品管理'
          dataIndex={['productId', 'productName']}
          codeType={config.cpgl}
          onChange={(name, code) => console.log(name, code)}
        />
        {/* <FirstHeaderC title='非标信息维护' />
                <SearchAndSelectC
                    form={this.props.form}
                    title='非标信息维护'
                    dataIndex={['codeId', 'code']}
                    codeType={config.fb}
                    onChange={(name, code) => console.log(name, code)}
                /> */}
        <FirstHeaderC title='资产管理计划维护' />
        <SearchAndSelectC
          form={this.props.form}
          title='资产管理计划维护'
          dataIndex={['valueId', 'value']}
          codeType={config.zcgljh}
          onChange={(name, code) => console.log(name, code)}
        />
        <FirstHeaderC title='理财直融' />
        <SearchAndSelectC
          form={this.props.form}
          title='理财直融'
          dataIndex={['search_LIKE_secuid', 'search_LIKE_secucode']}
          codeType={config.lczr}
          onChange={(name, code) => console.log(name, code)}
        />
        <FirstHeaderC title='查询组件用应用' />
        <AdvancedSearch
          dataSource={[
            {
              dataIndex: ['productId', 'productName'],
              title: '资产管理计划维护',
              type: DATA_ENTRY.SEARCHANDSELECTC,
              codeType: config.zcgljh,
              onChange: (name, code) => console.log(name, code),
            },
            {
              dataIndex: 'other',
              title: '其他查询条件',
              type: DATA_ENTRY.SELECT,
              dataSource: [{ value: 1, title: 1 }],
            },
          ]}
          onQuery={this.onQuery}
          onClear={this.onClear}
        />
      </>
    );
  }
}

export default Form.create()(SearchAndSelect);
